<!DOCTYPE html>
<html>
<head>
	<title></title>
	
</head>
<body>
	<!-- 
	cinder::ChannelT prefix 
	-->
	<ci prefix dox="cinder::ChannelT">
		<p>A Channel can be thought of as a grayscale image, and frequently is simply that. Its name comes from the most common use case, which is to represent a single color channel of an image, such as the red, green, blue or alpha channel of a <ci dox="cinder::SurfaceT">Surface</ci>. To acquire one of these color channels from a Surface, use <ci dox="Surface::getChannelRed()">getChannelRed()</ci>, <ci dox="SurfaceT::getChannelBlue()">getChannelBlue()</ci>, <ci dox="Surface::getChannelGreen()">getChannelGreen()</ci> or <ci dox="SurfaceT::getChannelAlpha()">getChannelAlpha()</ci>.

			<pre class="language-cpp"><code>Channel rChan = surf.getChannelRed(); // references just the red values of surf's pixels</code></pre>
		</p>
		<br/>
		
		<p>The code below constructs a Channel which is a grayscale image independent of a Surface that is 640x480 pixels:</p>
		<pre class="language-cpp"><code>Channel chan( 640, 480 );</code></pre>
		<br/>

		<p>You can also construct a Channel using an ImageSource, such as the result of loadImage(). In the code below, \a myImage will hold a grayscale version of the PNG file stored at the relative path "myImage.png":</p>
		<pre class="language-cpp"><code>Channel myImage = loadImage( "myImage.png" );</code></pre>
		<br/>
		<p>Channels come in two primary configurations, the traditional 8-bits unsigned integer represented by <ci dox="cinder::Channel8u">Channel8u</ci>, and a 32-bit float version suitable for high dynamic range images, represented by  <ci dox="cinder::Channel32f">Channel32f</ci>. <em>Channel</em> is a short-hand synonym for <em>Channel8u</em>. </p>
	</ci>

	<!-- 
	cinder::ChannelT::Iter prefix 
	-->
	<ci prefix dox="cinder::ChannelT::Iter">
		<p>The Iter class can be used to walk the pixels of a Channel using a nested for-loop, where the outer loop calls <ci dox="ChannelT::Iter::line()">line()</ci>, and the inner calls pixel().</p>

		<p>The code below implements an invert on the Area \a area of \a channel:</p>
<pre class="language-cpp"><code>
Channel::Iter iter = channel.getIter( area );
while( iter.line() ) {
	while( iter.pixel() ) {
		iter.v() = 255 - iter.v();
	}
}</code></pre>
		
		<p>In addition to v(), the Iter provides an accessor which accepts an offset in x &amp; y relative to the current location:</p>
<pre class="language-cpp"><code>
inputIter.v(1, 1); // will return the value of the pixel to the lower right of the current pixel
inputIter.v(0, -1); // will return the value of the pixel directly above the current pixel
</code></pre>
		
		<p>A final accessor, vClamped() also accepts an x &amp; y relative offset, but will not sample outside of the bounds of the iterator.</p>
<pre class="language-cpp"><code>
inputIter.vClamped(-2,0); // when called on the left edge of a row,
						  // this will simply return the left-most pixel's value
</code></pre>
	</ci>


	<!-- 
	cinder::ChannelT::ConstIter prefix 
	-->
	<ci prefix dox="cinder::ChannelT::ConstIter">
	<p>The ConstIter class can be used to walk the pixels of a Channel using a nested for-loop, where the outer loop calls line(), and the inner calls pixel().</p>

	<p>The code below finds the maximum value in the Area \a area of \a channel:</p>
<pre class="language-cpp"><code>
Channel::ConstIter iter = channel.getIter( area );
uint8_t maxValue = 0;
while( iter.line() ) {
	while( iter.pixel() ) {
		if( iter.v() > maxValue )
			maxValue = iter.v();
	}
}
</code></pre>
	
	<p>In addition to v(), the Iter provides an accessor which accepts an offset in x &amp; y relative to the current location:</p>

<pre class="language-cpp"><code>
inputIter.v(1, 1);  // will return the value of the pixel to the lower right of the current pixel
inputIter.v(0, -1); // will return the value of the pixel directly above the current pixel
</code></pre>

	<p>A final accessor, vClamped() also accepts an x &amp; y relative offset, but will not sample outside of the bounds of the iterator.</p>

<pre class="language-cpp"><code>
inputIter.vClamped(-2,0); // when called on the left edge of a row,
						  // this will simply return the left-most pixel's value
</code></pre>
	</ci>

</body>
</html>
